package ma.cdm.compteRendu.bo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * PersonneRole entity. @author Limouri Anouar
 */
@Entity
@Table(name="personnerole")

public class PersonneRole  implements java.io.Serializable {

	// Fields

     private PersonneRoleId id;
     private MembreComite membreComite;
     private Comite comite;
     private Role role;
     private Boolean admin;

	// Constructors

    /** default constructor */
    public PersonneRole() {
    }

	/** minimal constructor */
    public PersonneRole(PersonneRoleId id, MembreComite membreComite, Comite comite, Role role) {
        this.id = id;
        this.membreComite = membreComite;
        this.comite = comite;
        this.role = role;
    }
    
    /** full constructor */
    public PersonneRole(PersonneRoleId id, MembreComite membreComite, Comite comite, Role role, Boolean admin) {
        this.id = id;
        this.membreComite = membreComite;
        this.comite = comite;
        this.role = role;
        this.admin = admin;
    }

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idcomite", column = @Column(name = "IDCOMITE", nullable = false)),
			@AttributeOverride(name = "matricule", column = @Column(name = "MATRICULE", nullable = false, length = 20)),
			@AttributeOverride(name = "idrole", column = @Column(name = "IDROLE", nullable = false)) })
    public PersonneRoleId getId() {
        return this.id;
    }
    
    public void setId(PersonneRoleId id) {
        this.id = id;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="MATRICULE", nullable=false, insertable=false, updatable=false)

    public MembreComite getMembreComite() {
        return this.membreComite;
    }
    
    public void setMembreComite(MembreComite membreComite) {
        this.membreComite = membreComite;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="IDCOMITE", nullable=false, insertable=false, updatable=false)

    public Comite getComite() {
        return this.comite;
    }
    
    public void setComite(Comite comite) {
        this.comite = comite;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="IDROLE", nullable=false, insertable=false, updatable=false)

    public Role getRole() {
        return this.role;
    }
    
    public void setRole(Role role) {
        this.role = role;
    }
    
    @Column(name="ADMIN")

    public Boolean getAdmin() {
        return this.admin;
    }
    
    public void setAdmin(Boolean admin) {
        this.admin = admin;
    }
   

}